home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / bin / call < prev    next >
Text File  |  1994-03-10  |  2KB  |  43 lines

  1. : <<AH_SO
  2.     "call": @(#) JPRadley Mon Jun 01 20:49:48 EDT 1992 v. 0.3
  3.     This file uses 8-character tabstops.
  4.   An ecological recycling program for obsolete modems.
  5.   Uses 'xc' to dial on port M, giving a key ($1) to look up in file P, whose
  6. lines have the format "one or more keys<TAB>number"
  7.   Thus, if P has "mom dad hometown<TAB>1-234-567-8900", this will dial that
  8. number by typing "call mom", "call dad", "call home", "call town"; pick up
  9. the handset within 10 seconds, talk to the folks.
  10.   If $1 isn't a valid key in P, then dial $1 itself, so that "call 12024561000"
  11. will dial the White House in DC.
  12.   "call grklfitch" does no harm: the modem won't react to ATDTgrklfitch.
  13.   Unless you have version 3.3 or higher of 'xc', do NOT hit the BREAK key while
  14. this script is running; you may be left with scads of orphaned 'xc' processes.
  15. AH_SO
  16.  
  17. [ $# -lt 1 ] && exit    # one argument, key or number, needed
  18. M=ttyA07                # voice line with a modem on it
  19. P=/pub/jpr/lib/numbers  # data file
  20.                         # next line: <TAB> between '*' and '/'
  21. N=`sed -n "/$1/{s/.*$1.*    //p
  22. q
  23. }" $P`
  24. N=${N:-$1}              # if $1 wasn't a key, use $1 itself
  25. S=/usr/tmp/call_$$      # temporary script for xc to use
  26.  
  27. trap "rm $S" 0          # clean up
  28.  
  29. cat >$S <<JPR
  30. set bps 300             # override whatever the .xc startup file sets
  31. set cfile "/dev/tty"    # set up a hack for screen display, since later we
  32. capture "on"            #  redirect the usual xc output to the bit bucket
  33. file echo "dialing $N"  # spring the hack
  34. dial "W$N"              # precede by a 'w' to wait for dial tone
  35. pause 10                # give a human a chance to pick up the handset
  36. #hangup                 # dropping DTR may not work on old modems
  37. transmit "ath^m"        #   so use this instead
  38. pause 1                 # it's an old modem, give it a chance to react
  39. quit                    # xc quits and the modem is off the voice line
  40. JPR
  41.  
  42. xc -l$M -s$S 2>/dev/null     # shut off normal xc screen output
  43.